#include "./lab1Utils.cpp"

const int MAX_PROCESS_NUM = 5; // 进程数最大值

// 模拟进程调度

int main()
{
    PCBList ready("就绪"), end("结束");
    for (int i = 0; i < MAX_PROCESS_NUM; i++)
    {
        ready.insert(create_pcb("P" + to_string(i)));
    }
    while (!ready.empty())
    {
        auto first_in_list = ready.get(0);
        ready.remove(0);
        first_in_list->remaining_time--;
        first_in_list->priority--;
        cout << "当前进程执行后的信息" << endl;
        first_in_list->print();
        ready.print();
        end.print();
        if (first_in_list->remaining_time == 0)
        {
            end.insert(first_in_list);
        }
        else
        {
            ready.insert(first_in_list);
        }
    }

    cin.get();
    return 0;
}